<table class="eui-datagrid" id="grid${m}" style="height:100%"
	data-options="idField:'id',
		singleSelect:false,
		collapsible:true,
		striped:true,
		nowrap:true,
		fitColumns:true,scrollbarSize :0,
		url:'${path}/eframe/framework/funcgroup/group!list.action',
		method:'post',
		onLoadError:showErrorMsg,
		autoRowHeight:true,
		onClickRow: onlySelectDatagridRow,
		pagination:true,
		pageList:[1,5,10,15,20,30,50,100],
		pageSize:10,
		toolbar:'#tools${m}'">
	<thead>
		<tr width="100%">
			<th data-options="field:'id',checkbox:true"></th>
			<th data-options="field:'groupname',halign:'center',align:'left',width:50">功能组名称</th>
			<th data-options="field:'createTime',halign:'center',align:'center',width:50">创建时间</th>
		</tr>
	</thead>
</table>
<div id="tools${m}" style="padding:5px;height:auto">
	<div style="margin-bottom:5px">
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-add" plain="true" id="addbtn${m}">添加</a>
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-edit" plain="true" id="updatebtn${m}">修改</a>
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-remove" plain="true" id="deletebtn${m}">删除</a>
	</div>
	<div>
		<table class="condition-table">
			<input class="textbox-value" name="criteria.expr['applicationid_eq']" value="${appid}"/>
			<input class="textbox-value" name="criteria.expr['uplevelid_eq']" value="${groupid}"/>
			<tr>
				<th>功能组名称：</th>
				<td><input class="eui-textbox" style="width:120px" name="criteria.expr['groupname_like']"></td>
				<td><a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-search" plain="true" id="searchbtn${m}">查询</a></td>
			</tr>
		</table>
	</div>
</div>
<script>
	function loadTreeOnSubgrouplist() {
		$("#grid${m}").datagrid("reloadWithCriteria");
		var node = $("#tree").tree('find','${groupid}');
		$("#tree").tree('select',node.target);
		$("#tree").tree('reload',node.target);
	}

	$("#searchbtn${m}").click(function(){
		$("#grid${m}").datagrid("reloadWithCriteria");
	});
	
	$("#addbtn${m}").click(function(){
		dialog.open({
			width:600,
			height:300,
			form:'groupsaveform',
			url:'${path}/eframe/framework/funcgroup/add.ftl?appid=${appid}&groupid=${groupid}&grouplevel=${grouplevel}',
			success:loadTreeOnSubgrouplist
		});
	});
	
	$("#updatebtn${m}").click(function(){
		var rows = $("#grid${m}").datagrid("getSelections");
		if(rows.length > 0) {
			dialog.open({
				width:600,
				height:300,
				url:'${path}/eframe/framework/funcgroup/group!updateView.action?id='+rows[0].id,
				success:loadTreeOnSubgrouplist
			});
		}
	});
	
	$("#deletebtn${m}").click(function(){
		$("#grid${m}").datagrid("deleteSelected",{
			url: "${path}/eframe/framework/funcgroup/group!delete.action",
			success: loadTreeOnSubgrouplist
		});
	});
</script>